package com.briup.recognition.web.controller;

import com.briup.recognition.bean.BaseFile;
import com.briup.recognition.service.BaseFileService;
import com.briup.recognition.utils.Message;
import com.briup.recognition.utils.MessageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: xiaoxiao
 * @Description:
 * @DateTime: 2021/3/28$ 19:20$
 * @Params: $
 * @Return $
 */
@RestController
@RequestMapping("basefile")
public class BaseFileController {
    @Autowired
    private BaseFileService baseFileService;

    @GetMapping("query")
    public Message query(){
        List<BaseFile> list = baseFileService.query();
        return MessageUtil.success(list);
    }

    @PostMapping("saveOrUpdate")
    public Message saveOrUpdate(BaseFile baseFile){
        baseFileService.saveOrUpdate(baseFile);
        return MessageUtil.success("操作成功");
    }

    @DeleteMapping("deleteById")
    public Message deleteById(long id){
        baseFileService.deleteById(id);
        return MessageUtil.success("删除成功");
    }

}
